<?php
// +----------------------------------------------------------------------
// | 会员卡开卡流程
// +----------------------------------------------------------------------
// | Author: TongBC <50249101@qq.com>
// +----------------------------------------------------------------------
// | Date  : 2015/05/20
// +----------------------------------------------------------------------
include_once '/var/www/html/new/d/common/header.html';
include_once '/var/www/html/new/d/common/left.html';
include_once '/var/www/html/new/d/common/func.inc.php';

$ac=$GLOBALS['_ac'];
$pw=$GLOBALS['_pw'];
$s = new SoapClient(null,array("location" => "http://localhost/open/openService/pft_insideMX.php","uri" => "www.16u.com?ac_16u=$ac|pw_16u=$pw|auth_16u=true"));

if(isset($_REQUEST['vcode'])){
	echo $_SESSION['vcode'];
}


// 前端使用变量
$var = array();
$var['isMyDistributor'] = 0;



// 存在手机号获取信息
$member_info = array(
	'sex'    => 'M',
);
if(isset($_REQUEST['mobile']) && strlen($_REQUEST['mobile'])==11 && is_tel($_REQUEST['mobile'])){
	$mobile = $_REQUEST['mobile'];
	$sql = "select m.id as did,m.dname,m.cname,m.mobile,m.qq,m.alipay,e.email,m.dtype,e.com_type,e.com_name,e.sex from pft_member m left join pft_member_extinfo e on m.id=e.fid where m.account='$mobile' or m.mobile='$mobile' limit 1";
	$GLOBALS['le']->query($sql);
	$data1 = $GLOBALS['le']->fetch_assoc();
	if(is_array($data1)) $member_info = array_merge($member_info, array_filter($data1));
	$var['member'] = $member_info;
	
	// 判断是否为我的分销商
	$sid = $_SESSION['sid'];
	$did = $member_info['did'];
	$sql = "select id,status from pft_member_relationship where parent_id=$sid and son_id=$did and son_id_type=0 and ship_type=0 and status=0 limit 1";
	$GLOBALS['le']->query($sql);
	if($GLOBALS['le']->fetch_assoc()) $var['isMyDistributor'] = 1;
}



include('/var/www/html/new/d/tpl/membercard/mem_reg.html');
include('/var/www/html/new/d/common/footer.html');
?>